﻿using System;

namespace diantou.web.management
{
    /// <summary>
    /// 编辑问题题解
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class problemSolutionEdit : permissionView<problemSolutionEdit>
    {
        /// <summary>
        /// 问题
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.dataAccess.problem problem;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="problemId"></param>
        /// <returns></returns>
        private bool loadView(int problemId)
        {
            if ((currentUser.Permission & dataModel.user.permission.OnlineJudgeEditor) != 0)
            {
                problem = diantou.dataAccess.clientCache.Problem[problemId];
                if (problem != null)
                {
                    if (currentUser.Permission == dataModel.user.permission.Admin || problem.UserId == currentUser.Id) return true;
                    problem = null;
                }
            }
            AjaxResponse(new fastCSharp.code.cSharp.webView.errorPath { ErrorPath = currentUser.Path.NewFocus });
            return false;
        }
    }
}
